<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<%@include file="/common/repairAddress.jsp" %>
<!DOCTYPE html>
<html>
<head>
<title>检查记录--${fns:getConfig('productName')}</title>
<%@include file="/common/uihead.jsp" %>
<%@include file="/common/upload.jsp" %>
<script src="${ctxStatic}/js/public/public.js" type="text/javascript"></script>
</head>
<body>
	<ul class="nav nav-tabs" style="margin:0 4px 4px 4px;">
		<c:forEach items="${list}" var="menu"  varStatus="idxStatus">
			<li class="${menu.tag eq tag?'active':''}">
				<a href="${ctx}/${menu.href}${fn:indexOf(menuChild.href, '?') eq -1?'?':'&'}left=${fns:encodeParamUrl(left)}&top=${fns:encodeParamUrl(top)}&parentId=${fns:encodeParamUrl(parentId)}&LId=${fns:encodeParamUrl(LId)}&filter_EQS_tag=${menu.tag}">
					<i class="icon icon-list" style="margin-right:10px"></i><span>${menu.name}</span>
				</a>
			</li>
		</c:forEach>
	</ul>
    <tags:message content="${msg}" />
<form id="mainForm" class="form-horizontal" role="form" method="get"  name="mainForm">
<div class="breadcrumb form-search" style="background-color: #f5f5f5;">
			<div>
				<label>关键字:</label>
				<input type="text" oninput="queryForGrid('mainForm','jqGrid')" onporpertychange="queryForGrid('mainForm','jqGrid')"  name="filter_LIKES_tecYear_OR_remark" value="${filter_LIKES_tecYear_OR_remark}" placeholder="检查记录查询" />
				<sec:authorize ifAnyGranted="ROLE_jszkjc_editor" > 
				<a href="#javascript:void(0)" onclick= "openPublicModal();"  class="btn btn-primary" role="button" >新增&nbsp;</a>
				</sec:authorize>
			</div>
		</div>
  <table id="jqGrid"></table>
  <div id="jqGridPager"></div> 
</form>
<form id="publicForm" name="publicForm">
   <input type="hidden" name="token" value="${token}" id="token">
   <input type="hidden" name="id" id="id" value="">
   <input type="hidden" name="tag" id="tag" value="${tag}">
<div class="modal fade" id="publicModal" tabindex="-1" role="dialog" aria-labelledby="publicModal" aria-hidden="true" data-backdrop="static" style="width:900px;max-height:700px">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">新增/修改</h4>
					</div>
					<div class="modal-body" style="max-height:670px;">
						<table class="table"  style="border: none;margin-bottom: -14px">
							<tbody>
								<tr>
									<td>检查年份<font color="red">&nbsp;*</font>:</td>
									<td style="width:350px">
										<input  id="tecYear" name="tecYear" value="" class="required"
										onclick="WdatePicker({skin:'whyGreen',dateFmt:'yyyy',maxDate:'%y'})" class="Wdate" type="text">
									</td>
									<td>路桥隧检测经费:<br>(万元)</td>
									<td>
										<input name="totalFunds" id="totalFunds" type='text'  maxlength="18" value="0" >
									</td>
								</tr>
								<tr>
									<td >道路路况检测经费:<br>(万元)</td>
									<td >
										<input name="roadFunds" id="roadFunds" type='text'  maxlength="18" value="0" >
									</td>
									<td >桥梁检测经费:<br>(万元)</td>
									<td>
										<input name="bridgeFunds" id="bridgeFunds" type='text'  maxlength="18" value="0">
									</td>
								</tr>
								<tr>
									<td >隧道检测经费:<br>(万元)</td>
									<td >
										<input name="tunnelFunds" id="tunnelFunds" type='text'  maxlength="18" value="0">
									</td>
									<td >其他费用:<br>(万元)</td>
									<td>
										<input name="other" id="other" type='text' value="0"  maxlength="18">
									</td>
								</tr>
								<tr>
									<td >备　　注:</td>
									<td colspan="3">
										<div class="wordCount wyInline" id="wordCount">
											<textarea placeholder="" rows='3' id="remark"
												name="remark"></textarea>
											<span class="wordwrap"><var class="word">200</var>/200</span>
										</div>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="modal-footer" style="padding:4px 15px 5px;">
						<button type="button" class="btn btn-default" data-dismiss="close">关闭</button>
						<button type="button" class="btn btn-danger" onclick='publicDel("${ctx}/tecEvalut/delete.do");' style="display:none;" id="delPublic">删除</button>
						<button type="submit" class="btn btn-primary" id="subPublic" >提交</button>
					</div>
				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal -->
		</div>
</form>
	<script type="text/javascript">
	    var path = "${ctx}";
	    var tag = "${tag}";
		$(document).ready(function()
		{
			var jqgridH = $(window).height()-345;       
			$("#publicForm").validate({
				debug:true,
				rules: {
					totalFunds:{
						 number:true,
	                     min:0,
	                     max:9999999
					},
					roadFunds:{
						 number:true,
	                     min:0,
	                     max:9999999
					},
					bridgeFunds:{
						 number:true,
	                     min:0,
	                     max:9999999
					},
					tunnelFunds:{
						 number:true,
	                     min:0,
	                     max:9999999
					},
					other:{
						 number:true,
	                     min:0,
	                     max:9999999
					},
					tecYear:{
						remote:{
							url:'${ctx}/tecEvalut/checkTecYear.do',
							type:'POST',
							data:{
								id:function(){return $('#id').val();}
							}
						}
					}
				},
				messages: {
					tecYear:{remote:'该年份已经存在'}
				},
				submitHandler:function(form){
						$('#subPublic').attr('disabled','disabled');  //防止重复提交，请求完毕之前禁用提交按钮
						var url ="${ctx}/tecEvalut/save.do";
						publicSubmit(url);
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
			$("#jqGrid").jqGrid(
			{ url : '${ctx}/tecEvalut/list.do',
			  mtype : "GET",
			  datatype : "json",
			  page : 1,
			  viewrecords: true,
			  colModel:[
			    <sec:authorize ifAnyGranted="ROLE_jszkjc_editor" > 
				{ label : "操作", name : "id", 
					  width : 80,   align : 'center', sortable : false, search : false ,
					  classes:'ui-jqgrid-optClass',
					  formatter: function (cellValue, options, rowObject){
							return formatterOpt(cellValue);
					  }
				},
				</sec:authorize>
				{ label : "文件", name : "id", 
					  width : 100,   align : 'center', sortable : false, search : false ,
					  classes:'ui-jqgrid-optClass',
					  formatter: function (cellValue, options, rowObject){
							return "<a href='javascript:void(0);' onclick='openModal(\"T_YH_TECEVALUTION\",\"" + cellValue+"\",\"" + rowObject['tecYear']+"\");' role='button' >"+
							"<i class='icon-upload' style='margin-top:4px'></i>&nbsp;上传附件</a>";
					  }
				},
                {
           	        label: '检查年份',
           	        name: 'tecYear',
           	     	align:'center',
           	        width: 100,
           	     	formatter:function(cellValue,options,rowObject){
        	        	return "<span style='font-weight:bolder'>"+cellValue+"</span>";
        	        }
                },{
           	        label: '路桥隧检测经费 (万元)',
           	        name: 'totalFunds',
           	     	align:'center',
           	        width: 170,
           	     formatter:function(cellValue,options,rowObject){
        	        	return exchange(cellValue);
        	        }
                },{
           	        label: '道路路况检测经费 (万元)',
           	        name: 'roadFunds',
           	     	align:'center',
           	        width:170,
           	     formatter:function(cellValue,options,rowObject){
        	        	return exchange(cellValue);
        	        }
           	     	
                },{
           	        label: '桥梁检测经费 (万元) ',
           	        name: 'bridgeFunds',
           	     	align:'center',
           	        width: 130,
           	     formatter:function(cellValue,options,rowObject){
        	        	return exchange(cellValue);
        	        }
                },
                {
           	        label: '隧道检测经费  (万元)',
           	        name: 'tunnelFunds',
           	     	align:'center',
           	        width: 130,
           	     formatter:function(cellValue,options,rowObject){
        	        	return exchange(cellValue);
        	        }
                },
                {
           	        label: '其他费用 (万元) ',
           	        name: 'other',
           	     	align:'center',
           	        width: 150,
           	        formatter:function(cellValue,options,rowObject){
           	        	return exchange(cellValue);
           	        }
                },
                {
           	        label: '已上传检查文件',
           	        name: 'bulletinNumber',
           	     	align:'center',
           	        width: 150,
           	        formatter:function(cellValue,options,rowObject){
           	        	if(cellValue>0){
           	        		return "<div><img src='${ctx}/images/right.jpg' style='width:20px;height:20px'></div>";
           	        	}else{
           	        		return "<img src='${ctx}/images/error.jpg' style='width:20px;height:20px'>";
           	        	}
           	        }
                },{
           	        label: '备注',
           	        name: 'remark',
           	     	align:'center',
           	        width: 225
                }
						],
			autowidth : false,width:$(window).width()-248, height : jqgridH,scrollOffset:0, shrinkToFit : 400, rowNum : 10, viewrecords : true, rownumbers : true,
			jsonReader:{
    			root: "result",
    			page: "currentPage",
    			total: "totalPages",
    			records: "totalCount",
    			repeatitems: true,
    			cell: "cell",
    			id: "id",
    			userdata: "userdata",
    			subgrid: {root:"results", repeatitems: true, cell:"cell"}
    		},
    		prmNames: {
				page:"pageNo",
				rows:"pageSize",
				sort: "orderBy",
				order: "order",
				search:"_search",
				nd:"nd", id:"id",
				oper:"oper",
				editoper:"edit",
				addoper:"add",
				deloper:"del",
				subgridid:"id",
				npage: null,
				totalrows:"totalCounts"
			}, 
			rowList :[10,20,30], 
			pager : "#jqGridPager"
			});
		});
		
	function formatterOpt(id) {
		return "<a href='javascript:void(0);' onclick='updatePublic(\"" + id
				+ "\",\"${ctx}/tecEvalut/show.do\");' id='" + id
				+ "'  title='修改'><i class='icon icon-edit' style='margin-top:4px;'></i>&nbsp;修改</a>";
	}
</script>
<jsp:include page="/WEB-INF/views/system/attachment.jsp"/> 
</body>
</html>